<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>米行域名批量交易平台-我要投资</title>
<include file="./Public/public/public.html" />
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/detail.css">
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/bootstrap.css">
</head>
<body>
	<include file="./Public/public/top.html" />
	<section class="">
			<div class="container jkxq">
				<div class="row">
					<div class="col-sm-2">
					</div>
				</div>
				<div class="row">
					<ol class="breadcrumb hidden-xs">
						<li><a href="/">首页</a></li>
						<li><a href="/Investment/lend.html">我要借款</a></li>
						<li><a href="/Investment/lend.html">投资详情</a></li>
						<li class="active">投资{$invecate.domtypname}授信额度{$invecate.credit}</li>
					</ol>
					<div class="col-sm-12 jkxq_info">
						<div class="col-sm-8 left">
							<div class="info">
								<h2>{$username} 理财 ￥{$shengyu}元</h2>
								<table>
									<tbody>
									<tr>
										<td>
											<h3>年利率</h3>
											{$invecate.rate}%
										</td>
										<td>
											<h3>理财金额</h3>
											￥{$shengyu}元
										</td>
										<td>
											<h3>投资周期</h3>
											
											<if condition="$info['term_begin']-30 lt 0">
	                				<span class="f18">{$info.term_begin}</span> <span class="gary">天</span>
	                			<else/>
	                				<span class="f18">{$info['term_begin']/30}</span> <span class="gary">个月</span>
	                			</if>
	                			-至-
	                			<if condition="$info['term_end']-30 lt 0">
	                				<span class="f18">{$info.term_end}</span> <span class="gary">天</span>
	                			<else/>
	                				<span class="f18">{$info['term_end']/30}</span> <span class="gary">个月</span>
	                			</if>
	                									
										</td>
										<td>
											<h3>还款方式</h3>
											每月还息
										</td>
									</tr>
									</tbody>
								</table>
								<ul>
									<li>
										<div class="labels">投资进度：</div>
										<div class="progress_area">
											<div class="progress">
												<div class="progress-bar progress-bar-success progress-bar-striped active " role="progressbar" aria-valuenow="40" aria-valuemin="0" 
												aria-valuemax="100" style="width:{$jindu}%;">
												</div>
											</div>
										</div>
										<span class="progress_info">{$jindu}%</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">发标时间：</div>
										{$info.create_time}  										
										<div class="clear"></div>
									</li>
									
									<li>
										<div class="labels">质押域名：</div>
										<span class="amount-pay-out">{$invecate.domtypname}</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">授信额度：</div>
										<span class="amount-pay-out">{$invecate.credit}</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">年利率：</div>
										<span class="amount-pay-out">{$invecate.rate}%</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">当前状态：</div>
										<span class="amount-pay-out">
										<if condition="$shengyu eq 0">
										已结束
										<else/>
										投资火热进行中
										</if>
										</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">项目描述：</div>
										<div class="description">
																	{$info.descrp}	
																		
																					</div>
										<div class="clear"></div>
									</li>
								</ul>
							</div>
						</div>
						<div class="col-sm-4 right">
							<div class="info">
								<p>
									借款<span class="amount-pay-out">{$invecate.credit}</span>元，
									期限<span class="font_c_blue">1 个月</span>，
								</p><br/>
								<p>
								需要支付利息/管理费
                            <span class="amount-pay-in">
                            ￥{$lixi|round=###,2}/￥{$invecate['credit']*$tradeFee|round=###,2}</span>
								</p><br/>
								<if condition="$shengyu eq 0">
								<input type="button" class="btn btn-primary2 btn-warning btn-xs-block" value="已完成">
								<else/>
								<p>
								<select name="term_begin" class="form-control" id="termMonth">
										<option value='0'>-请选择贷款周期-</option>
										<option value="7">7天</option>
										<option value="15">15天</option>
										<option value="30">1个月</option>
										<option value="60">2个月</option>
										<option value="90">3个月</option>
										<option value="120">4个月</option>
										<option value="150">5个月</option>
										<option value="180">6个月</option>
										<option value="210">7个月</option>
										<option value="240">8个月</option>
										<option value="270">9个月</option>
										<option value="300">10个月</option>
										<option value="330">11个月</option>
										<option value="360">12个月</option>
									</select>
									</p>
									<br/>
								<p class=" font_c_grey">最小借款额：¥{$invecate.credit}  当前 总可借：￥{$shengyu}</p>
								<br/>
								<p>
									<div class="form-inline">
											<div class="form-group">
												<label for="inputAmount"><i>*</i>输入金额：</label>
												<input class="form-control" id="inputAmount" name="Amount" 
												type="number" value="" placeholder="必须是{$invecate.credit}的整数倍">
												<span class="form-control-tips">
												<i class="iconfont"></i></span>
											</div>
											<div class="table_area">
											</div>
										<input type="button" class="btn btn-primary2 btn-warning btn-xs-block" value="立即借款" id="jiekuan">
										</div>
										
								</p>
								</if>
							</div>
						</div>
						<div class="double_line"></div>
					</div>
				</div>
			</div>
		</section>
		
	<include file="./Public/public/footer.html" />
	<script type="text/javascript">
	var rate = "{$invecate.rate}";
	var credit = "{$invecate.credit}";
	var termbegin="{$info.term_begin}";
	var termend="{$info.term_end}";
	$("#jiekuan").click(function(){
		var cateid="{$cateid}";
		if(checkinput($("#inputAmount").val(),credit)){
			var id="{$info.id}";
			$.ajax({  
				url:"{:U('Mycredit/toloan')}",
				data:{'id':id,'money':$('#inputAmount').val(),'domtype':cateid,'term':$("#termMonth").val()},
				dataType:'json',
				type:'post',
				success:function(data){
					showModal({msg:data.info});	
				}
			});
		}
	});
	
	function checkinput(num,credit){
		if(num==0){
			showModal({msg:"请输入"+credit+"的整数倍"});
			return false;
		}
		else if(num%credit!=0){
			showModal({msg:"请输入"+credit+"的整数倍"});
			return false;
		}
		else if(num>parseInt('{$shengyu}')){
			showModal({msg:"此项目最大可借{$shengyu}元"});
			return false;
		}else if(parseInt($("#termMonth").val())==0){
			showModal({msg:"请选择借款周期"});
			return false;
		}else if(parseInt($("#termMonth").val())<=parseInt(termend) && parseInt($("#termMonth").val())>=parseInt(termbegin)){
		}else {
			showModal({msg:"请选择此投资项目允许的周期范围"});
			return false;
		}
		return true;
	}
	
	$("#termMonth").change(function(){
		if(parseInt($(this).val())==0){
			showModal({msg:"请选择借款周期"});
			return false;
		}
		if(parseInt($(this).val())<=parseInt(termend) && parseInt($(this).val())>=parseInt(termbegin)){
		}else{
			showModal({msg:"请选择此投资项目允许的周期范围"});
			return false;
		}
	});
	</script>
</body>
</html>